//
//  EditPrivateInfoViewController.m
//  HuaRun2
//
//  Created by admin on 2017/11/2.
//  Copyright © 2017年 Sunny. All rights reserved.
//

#import "EditPrivateInfoViewController.h"
#import "LabelTextfieldView.h"
#import "LineView.h"
#import "PGDatePicker.h"
#import "ChooseCountryViewController.h"
#import "ConditionModel.h"
#import "GDTJCChooseContentView.h"
#import "Contact_DetailModel.h"

@interface EditPrivateInfoViewController () <PGDatePickerDelegate>

@property(nonatomic, strong)UIScrollView * scrollView;
//国籍view
@property(nonatomic, strong)UIView * guoJIView;
//生日view
@property(nonatomic, strong)UIView * shengRiView;
//生肖view
@property(nonatomic, strong)UIView * shengXiaoView;
//星座view
@property(nonatomic, strong)UIView * xingZuoView;

@property(nonatomic, strong)NSArray * xingZuoArray;
@property(nonatomic, strong)NSArray * shengXiaoArray;

//信仰
@property(nonatomic, strong)LabelTextfieldView * xinYangLF;
//婚姻状况
@property(nonatomic, strong)LabelTextfieldView * hunYinLF;

//配偶名字
@property(nonatomic, strong)LabelTextfieldView * peiOuLF;
//儿女个数
@property(nonatomic, strong)LabelTextfieldView * childNumLF;

//儿女名字
@property(nonatomic, strong)LabelTextfieldView * childNameLF;
//特殊身体状况
@property(nonatomic, strong)LabelTextfieldView * healthLF;

//食物偏好
@property(nonatomic, strong)LabelTextfieldView * foodLF;
//红酒偏好
@property(nonatomic, strong)LabelTextfieldView * wineLF;

//会员身份
@property(nonatomic, strong)LabelTextfieldView * vipLF;
//专业资质
@property(nonatomic, strong)LabelTextfieldView * proLF;
//备注
@property(nonatomic, strong)LabelTextfieldView * noteLF;
//选择内容
@property (nonatomic, strong)GDTJCChooseContentView * pickContentView;
//时间
@property (nonatomic, strong)NSDateComponents *dateComponents;
@end

@implementation EditPrivateInfoViewController


- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    
    _scrollView.contentSize = CGSizeMake(kMainScreenWidth, CGRectGetMaxY(self.noteLF.frame) + 10);
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewInit {
    self.navigationItem.title = NSLocalizedString(@"编辑联系人基本信息", nil);
    self.view.backgroundColor = [UIColor whiteColor];

    [super viewInit];

    [self.view addSubview:self.scrollView];
    
    self.guoJIView = [self makeShengRiViewWithText:NSLocalizedString(@"nationality", nil)];
    [self.scrollView addSubview:self.guoJIView];

    [self.scrollView addSubview:self.xinYangLF];
    
    self.shengRiView = [self makeShengRiViewWithText:NSLocalizedString(@"birthday", nil)];
    [self.scrollView addSubview:self.shengRiView];
    
    self.shengXiaoView = [self makeShengRiViewWithText:NSLocalizedString(@"shengxiao", nil)];
    [self.scrollView addSubview:self.shengXiaoView];

    self.xingZuoView = [self makeShengRiViewWithText:NSLocalizedString(@"constellation", nil)];
    [self.scrollView addSubview:self.xingZuoView];

    [self.scrollView addSubview:self.hunYinLF];
    [self.scrollView addSubview:self.peiOuLF];
    [self.scrollView addSubview:self.childNumLF];
    [self.scrollView addSubview:self.childNameLF];
    [self.scrollView addSubview:self.healthLF];
    [self.scrollView addSubview:self.foodLF];
    [self.scrollView addSubview:self.wineLF];
    [self.scrollView addSubview:self.vipLF];
    [self.scrollView addSubview:self.proLF];
    [self.scrollView addSubview:self.noteLF];

    weakself(ws);
    [self nbRightImageName:@"save" title:nil taget:self clickBlock:^(id result) {
        NSLog(@"....完成");
        [ws submitMethod];
    }];
    [self fetchDicListByType:@"horoscope"];
    [self fetchDicListByType:@"zodiac"];
    
}

- (void)methodBind {
    weakself(ws);
    
    [_guoJIView addTapActionWithBlock:^(UIGestureRecognizer *gestureRecoginzer) {
        [ws chooseGuoJi];
    }];
    
    [_shengRiView addTapActionWithBlock:^(UIGestureRecognizer *gestureRecoginzer) {
        [ws chooseShengRi];
    }];
    
    UITapGestureRecognizer * shengxiaoTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(chooseShengXiao)];
    [_shengXiaoView addGestureRecognizer:shengxiaoTap];

    UITapGestureRecognizer * xingZuoTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(chooseXingZuo)];
    [_xingZuoView addGestureRecognizer:xingZuoTap];

    [self configureInfo];
}

- (void)layoutInit {
    [super layoutInit];

    weakself(ws);
    [self.guoJIView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.scrollView).offset(kMargin10);
        make.left.right.mas_equalTo(ws.scrollView);
        make.width.mas_equalTo(kMainScreenWidth);
        make.height.mas_equalTo(35);
    }];
    
    [self.xinYangLF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.guoJIView.mas_bottom).offset(kMargin10);
        make.left.right.mas_equalTo(ws.scrollView);
    }];

    [self.shengRiView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.xinYangLF.mas_bottom).offset(kMargin10);
        make.left.right.mas_equalTo(ws.guoJIView);
        make.width.mas_equalTo(kMainScreenWidth);
        make.height.mas_equalTo(35);
    }];
    
    [self.shengXiaoView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.shengRiView.mas_bottom).offset(kMargin10);
        make.left.width.height.mas_equalTo(ws.shengRiView);
    }];
    
    [self.xingZuoView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.shengXiaoView.mas_bottom).offset(kMargin10);
        make.left.width.height.mas_equalTo(ws.shengRiView);
    }];

    [self.hunYinLF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.xingZuoView.mas_bottom).offset(kMargin10);
        make.left.right.mas_equalTo(ws.scrollView);
    }];
    
    [self.peiOuLF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.hunYinLF.mas_bottom).offset(kMargin10);
        make.left.right.mas_equalTo(ws.scrollView);
    }];
    [self.childNumLF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.peiOuLF.mas_bottom).offset(kMargin10);
        make.left.right.mas_equalTo(ws.scrollView);
    }];
    [self.childNameLF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.childNumLF.mas_bottom).offset(kMargin10);
        make.left.right.mas_equalTo(ws.scrollView);
    }];
    [self.healthLF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.childNameLF.mas_bottom).offset(kMargin10);
        make.left.right.mas_equalTo(ws.scrollView);
    }];
    [self.foodLF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.healthLF.mas_bottom).offset(kMargin10);
        make.left.right.mas_equalTo(ws.scrollView);
    }];
    [self.wineLF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.foodLF.mas_bottom).offset(kMargin10);
        make.left.right.mas_equalTo(ws.scrollView);
    }];
    [self.vipLF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.wineLF.mas_bottom).offset(kMargin10);
        make.left.right.mas_equalTo(ws.scrollView);
    }];
    [self.proLF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.vipLF.mas_bottom).offset(kMargin10);
        make.left.right.mas_equalTo(ws.scrollView);
    }];
    [self.noteLF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.proLF.mas_bottom).offset(kMargin10);
        make.left.right.mas_equalTo(ws.scrollView);
    }];

}
#pragma mark 方法

- (void)configureInfo {
    UILabel * guojiValueLab = [_guoJIView viewWithTag:300];
    UILabel * xingZuoValueLab = [_xingZuoView viewWithTag:300];
    UILabel * shengXiaoValueLab = [_shengXiaoView viewWithTag:300];
    UILabel * shengRiValueLab = [_shengRiView viewWithTag:300];
    
    guojiValueLab.text  =[NSString showSpaceStringWithStr: _detailModel.pnNationality];
    xingZuoValueLab.text  =[NSString showSpaceStringWithStr:_detailModel.horoscope];
    shengXiaoValueLab.text = [NSString showSpaceStringWithStr: _detailModel.pnChineseZidiac];
    
    _peiOuLF.textField.text  =[NSString showSpaceStringWithStr: _detailModel.pnSpouseName];
    
    _hunYinLF.textField.text  =[NSString showSpaceStringWithStr:  _detailModel.pnMaritalStatus];
    
    NSString * monthStr = [NSString isemptyStr: _detailModel.birthdayMonth] ? @" " : (
                                                                                     [NSString stringWithFormat:@"-%@",                     _detailModel.birthdayMonth]);
    NSString * dayStr = [NSString isemptyStr: _detailModel.birthdayDay] ? @" " : (                                                                                     [NSString stringWithFormat:@"-%@",                     _detailModel.birthdayDay]);
    
    shengRiValueLab.text  = [NSString stringWithFormat:@"%@%@%@",
                              [NSString showSpaceStringWithStr:  _detailModel.birthdayYear],
                              monthStr,
                              dayStr];
    
    _childNumLF.textField.text  =[NSString showSpaceStringWithStr:  _detailModel.pnNoOfChild];
    _childNameLF.textField.text  =[NSString showSpaceStringWithStr:  _detailModel.pnChildName];
    _healthLF.textField.text  =[NSString showSpaceStringWithStr: _detailModel.pnSpecialHealthCondition];
    
    _foodLF.textField.text  =[NSString showSpaceStringWithStr: _detailModel.prFoodPerference];
    _wineLF.textField.text  =[NSString showSpaceStringWithStr: _detailModel.prWinePerference];
    
    _vipLF.textField.text  =[NSString showSpaceStringWithStr: _detailModel.prMembership];
    _proLF.textField.text  =[NSString showSpaceStringWithStr: _detailModel.prProfessionalQualification];
    
    _proLF.textField.text  =[NSString showSpaceStringWithStr: _detailModel.pnRemarks];
}

//选择国籍
- (void)chooseGuoJi {
    UILabel * guojiValueLab = [_guoJIView viewWithTag:300];
    
    ChooseCountryViewController * vc = [ChooseCountryViewController new];
    vc.clickBlock = ^(id result) {
        ConditionModel * model = result;
        guojiValueLab.text = [NSString stringWithFormat:@"%@%@",
                                   model.value, model.valueCinese];
    };
    [self.navigationController pushViewController:vc animated:YES];
}
//选择生日
- (void)chooseShengRi {
    UIColor * orangeColor = [UIColor orangeColor];
    PGDatePicker *datePicker = [[PGDatePicker alloc]init];
    datePicker.confirmButtonTextColor = orangeColor;
    datePicker.titleColorForSelectedRow = orangeColor;
    datePicker.titleColorForOtherRow = orangeColor;
    datePicker.lineBackgroundColor = orangeColor;
    datePicker.delegate = self;
    [datePicker show];
    datePicker.datePickerMode = PGDatePickerModeDate;
}
//选择生肖
- (void)chooseShengXiao {
    UILabel * guojiValueLab = [_shengXiaoView viewWithTag:300];

    self.pickContentView = [[GDTJCChooseContentView alloc] initWithFrame:(CGRectMake(0, 0, kMainScreenWidth, kMainScreenHeight))];
    [_pickContentView.cancelBtn addTarget:self action:@selector(cancelMethod) forControlEvents:(UIControlEventTouchUpInside)];
    [_pickContentView.doneBtn addTarget:self action:@selector(doneMethod) forControlEvents:(UIControlEventTouchUpInside)];
    _pickContentView.dataArray = self.shengXiaoArray;
    _pickContentView.clickBlock = ^(id result) {
        ConditionModel * conditionModel = result;
        guojiValueLab.text = conditionModel.value;
    };
    [self.view addSubview:_pickContentView];
}

- (void)cancelMethod {
    [_pickContentView dismissSelfMethod];
}

- (void)doneMethod {
    [_pickContentView doneMethod];
}

//tableview样式点击完成方法
- (void)chooseViewTableStyleDoneMethodWithString:(NSString *)str {
    [_pickContentView dismissSelfMethod];
}

//选择星座
- (void)chooseXingZuo {
    UILabel * guojiValueLab = [_xingZuoView viewWithTag:300];
    
    self.pickContentView = [[GDTJCChooseContentView alloc] initWithFrame:(CGRectMake(0, 0, kMainScreenWidth, kMainScreenHeight))];
    [_pickContentView.cancelBtn addTarget:self action:@selector(cancelMethod) forControlEvents:(UIControlEventTouchUpInside)];
    [_pickContentView.doneBtn addTarget:self action:@selector(doneMethod) forControlEvents:(UIControlEventTouchUpInside)];
    _pickContentView.dataArray = self.xingZuoArray;
    _pickContentView.clickBlock = ^(id result) {
        ConditionModel * conditionModel = result;
        guojiValueLab.text = conditionModel.value;
    };
    [self.view addSubview:_pickContentView];
}

- (void)submitMethod {
    UILabel * guojiValueLab = [_guoJIView viewWithTag:300];
    NSString * guojiName = [NSString showStringWithStr:guojiValueLab.text];
    
    NSString * xingYang =  [NSString showStringWithStr:_xinYangLF.textField.text];
    
    NSString * birthdayYearStr = @"";
    NSString * birthdayMonthStr = @"";
    NSString * birthdayDayStr = @"";
    
    if (self.dateComponents) {
        birthdayYearStr = [NSString stringWithFormat:@"%ld", _dateComponents.year];
        birthdayMonthStr = [NSString stringWithFormat:@"%ld", _dateComponents.month];
        birthdayDayStr = [NSString stringWithFormat:@"%ld", _dateComponents.day];
    }
    if (self.detailModel) {
        birthdayYearStr = _detailModel.birthdayYear;
        birthdayMonthStr = _detailModel.birthdayMonth;        
        birthdayDayStr = _detailModel.birthdayDay;
    }
    UILabel * xingZuoValueLab = [_xingZuoView viewWithTag:300];
    NSString * xingZuoName = [NSString showStringWithStr:xingZuoValueLab.text];

    UILabel * shengXiaoValueLab = [_shengXiaoView viewWithTag:300];
    NSString * shengXiaoName = [NSString showStringWithStr:shengXiaoValueLab.text];
    
    NSString * hunYinStatus = [NSString showStringWithStr:_hunYinLF.textField.text];
    NSString * peiOuName = [NSString showStringWithStr:_peiOuLF.textField.text];

    NSString * childNum = [NSString showStringWithStr:_childNumLF.textField.text];
    NSString * childName = [NSString showStringWithStr:_childNameLF.textField.text];

    NSString * healthStatus = [NSString showStringWithStr:_healthLF.textField.text];
    NSString * food = [NSString showStringWithStr:_foodLF.textField.text];

    NSString * wine = [NSString showStringWithStr:_wineLF.textField.text];
    NSString * vip = [NSString showStringWithStr:_vipLF.textField.text];
    NSString * pro = [NSString showStringWithStr:_proLF.textField.text];
    NSString * remarks = [NSString showStringWithStr:_noteLF.textField.text];
    
       //#电话、内地手机是哪个参数
    NSDictionary * dic = @{@"id": _contactId ? _contactId : @"",
                           @"accountId": _detailModel.accountId ? _detailModel.accountId : @"",                           
                           @"pnNationality": guojiName,
                           @"pnReligion": xingYang,
                           
                           @"birthdayDay": birthdayDayStr,
                           @"birthdayMonth": birthdayMonthStr,
                           @"birthdayYear": birthdayYearStr,
                           
                           @"pnChineseZidiac": shengXiaoName,
                           @"horoscope": xingZuoName,
                           
                           @"pnMaritalStatus" : hunYinStatus,
                           @"pnSpouseName": peiOuName,
                           
                           @"pnNoOfChild" : childNum,
                           @"pnChildName": childName,
                           
                           @"pnSpecialHealthCondition": healthStatus,
                           @"prFoodPerference": food,
                           @"prWinePerference": wine,
                           @"prMembership": vip,
                           @"prProfessionalQualification": pro,
                           @"remarks": remarks
                           };
    
    NSString * url = [NSString stringWithFormat:@"%@%@", kBaseUrl,
                      kEditContactUrl];
    
    weakself(ws);
    [self showActivity:NSLocalizedString(@"正在提交", nil)];
    
    [NetWorkHelper postWithURLString:url parameters:dic success:^(id object) {
        if (![object[@"code"] isEqual: kSuccessCode]) {
            NSString * info = [NSString isemptyStr:object[@"msg"]] ? kUnknownError : object[@"msg"];
            [ws showWithText:info];
            return;
        }
        
        [ws showAlert:kEditSuccess completionBlock:^{
            [ws.navigationController popViewControllerAnimated:YES];
        }];
        
        
    } failure:^(NSError *error) {
        [ws showWithText:kNetworkError];
    }];
}

- (void)fetchDicListByType:(NSString *)type {
    
    NSString * url = [NSString stringWithFormat:@"%@%@", kBaseUrl,
                      kContact_dataDic_Url];
    NSDictionary * dic = @{@"type":type};
    
    weakself(ws);
    [NetWorkHelper getWithURLString:url parameters:dic success:^(id object) {
        if (![object[@"code"] isEqual: kSuccessCode]) {
            NSString * info = [NSString isemptyStr:object[@"msg"]] ? kUnknownError : object[@"msg"];
            [ws showWithText:info];
            return;
        }
        NSArray * addressArray = [NSArray yy_modelArrayWithClass:[ConditionModel class]
                                                            json:object[@"obj"]];
        
        if ([type isEqualToString: @"horoscope"]) {
            ws.xingZuoView.userInteractionEnabled = YES;
            ws.xingZuoArray = addressArray;
            
        }else {
            ws.shengXiaoView.userInteractionEnabled = YES;
            ws.shengXiaoArray = addressArray;
        }
    } failure:^(NSError *error) {
        [ws showWithText:kNetworkError];
    }];
    
}


#pragma mark - PGDatePickerDelegate
- (void)datePicker:(PGDatePicker *)datePicker didSelectDate:(NSDateComponents *)dateComponents {
    NSLog(@"dateComponents = %@", dateComponents);
    self.dateComponents = dateComponents;
    
    UILabel * shengRiLab = [_shengRiView viewWithTag:300];
    shengRiLab.text = [NSString stringWithFormat:@"%ld年%ld月%ld日",
                       dateComponents.year, dateComponents.month, dateComponents.day];
    self.detailModel.birthdayYear = [NSString stringWithFormat:@"%ld", dateComponents.year];
    self.detailModel.birthdayMonth = [NSString stringWithFormat:@"%ld", dateComponents.month];
    self.detailModel.birthdayDay = [NSString stringWithFormat:@"%ld", dateComponents.day];
    
}

#pragma mark - getter
- (UIScrollView *)scrollView {
    if (!_scrollView) {
        self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, kMainScreenWidth, kMainScreenHeight - 64)];
        _scrollView.showsVerticalScrollIndicator = NO;
        _scrollView.showsHorizontalScrollIndicator = NO;
    }
    return _scrollView;
}
/*
//国籍
- (UIView *)makeGuoJIView {
    UIView * guoJIView = [UIView new];
//    guoJIView.backgroundColor = kRandomColor;
    
    weakself(ws);
    [guoJIView addTapActionWithBlock:^(UIGestureRecognizer *gestureRecoginzer) {
        [ws chooseGuoJi];
    }];
    UILabel * label = [UILabel new];
    label.textAlignment = NSTextAlignmentRight;
    label.font = kGeneralFontSize;
    label.textColor = [UIColor colorWithHex:@"3c3c3c"];
    label.text = NSLocalizedString(@"nationality", nil);
    [guoJIView addSubview:label];
    
    UILabel * valueLabel = [UILabel new];
    valueLabel.textAlignment = NSTextAlignmentLeft;
    valueLabel.font = kGeneralFontSize;
    valueLabel.textColor = [UIColor colorWithHex:@"3c3c3c"];
//    valueLabel.backgroundColor = kRandomColor;
    [guoJIView addSubview:valueLabel];
    
    LineView * line1 = [LineView new];
    [guoJIView addSubview:line1];
    
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.centerY.mas_equalTo(valueLabel);
        make.right.mas_equalTo(valueLabel.mas_left).offset(-kMargin15);
    }];

    [valueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(guoJIView).offset(-kMargin15);
        make.centerY.mas_equalTo(guoJIView);
        make.height.mas_equalTo(35);
        make.width.mas_equalTo(guoJIView).multipliedBy(0.6);
    }];
    
    [line1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(guoJIView).offset(kMargin10);
        make.right.mas_equalTo(guoJIView).offset(-kMargin10);
        make.height.mas_equalTo(1);
        make.bottom.mas_equalTo(guoJIView);
    }];
    
    return guoJIView;
}*/
//        @"宗教信仰";
- (LabelTextfieldView *)xinYangLF {
    if (!_xinYangLF) {
        self.xinYangLF = [LabelTextfieldView new];
        _xinYangLF.nameLab.text =NSLocalizedString(@"religious_belief", nil);
    }
    return _xinYangLF;
}

//        @"婚姻状况";
- (LabelTextfieldView *)hunYinLF {
    if (!_hunYinLF) {
        self.hunYinLF = [LabelTextfieldView new];
        _hunYinLF.nameLab.text =NSLocalizedString(@"marital_status", nil);
    }
    return _hunYinLF;
}

//        @"配偶名字";
- (LabelTextfieldView *)peiOuLF {
    if (!_peiOuLF) {
        self.peiOuLF = [LabelTextfieldView new];
        _peiOuLF.nameLab.text =NSLocalizedString(@"spouse_name", nil);
    }
    return _peiOuLF;
}
//        @"儿女个数";
- (LabelTextfieldView *)childNumLF {
    if (!_childNumLF) {
        self.childNumLF = [LabelTextfieldView new];
        _childNumLF.nameLab.text =NSLocalizedString(@"number_of_children", nil);
        _childNumLF.textField.keyboardType = UIKeyboardTypeNumberPad;
    }
    return _childNumLF;
}
//        @"婚姻状况";
- (LabelTextfieldView *)childNameLF {
    if (!_childNameLF) {
        self.childNameLF = [LabelTextfieldView new];
        _childNameLF.nameLab.text =NSLocalizedString(@"name_of_children", nil);
    }
    return _childNameLF;
}
//        @"特殊身体状况";
- (LabelTextfieldView *)healthLF {
    if (!_healthLF) {
        self.healthLF = [LabelTextfieldView new];
        _healthLF.nameLab.text =NSLocalizedString(@"special_health", nil);
    }
    return _healthLF;
}
//        @"食物偏好";
- (LabelTextfieldView *)foodLF {
    if (!_foodLF) {
        self.foodLF = [LabelTextfieldView new];
        _foodLF.nameLab.text =NSLocalizedString(@"food_preference", nil);
    }
    return _foodLF;
}
//        @"红酒偏好";
- (LabelTextfieldView *)wineLF {
    if (!_wineLF) {
        self.wineLF = [LabelTextfieldView new];
        _wineLF.nameLab.text =NSLocalizedString(@"red_wine_preference", nil);
    }
    return _wineLF;
}
//"membership"= "会员身份";//
- (LabelTextfieldView *)vipLF {
    if (!_vipLF) {
        self.vipLF = [LabelTextfieldView new];
        _vipLF.nameLab.text =NSLocalizedString(@"membership", nil);
    }
    return _vipLF;
}
//_proKeyLab.text =NSLocalizedString(@"zhuanyezizhi", nil);
////        @"专业资质";
- (LabelTextfieldView *)proLF {
    if (!_proLF) {
        self.proLF = [LabelTextfieldView new];
        _proLF.nameLab.text =NSLocalizedString(@"zhuanyezizhi", nil);
    }
    return _proLF;
}
//_noteKeyLab.text = NSLocalizedString(@"marks", nil);
//        @"备注";
- (LabelTextfieldView *)noteLF {
    if (!_noteLF) {
        self.noteLF = [LabelTextfieldView new];
        _noteLF.nameLab.text =NSLocalizedString(@"marks", nil);
    }
    return _noteLF;
}


//生日view
- (UIView *)makeShengRiViewWithText:(NSString *)text {
    UIView * guoJIView = [UIView new];
    
    UILabel * label = [UILabel new];
    label.textAlignment = NSTextAlignmentRight;
    label.font = kGeneralFontSize;
    label.textColor = [UIColor colorWithHex:@"3c3c3c"];
    label.text = text;
    [guoJIView addSubview:label];
    
    UILabel * valueLabel = [UILabel new];
    valueLabel.textAlignment = NSTextAlignmentLeft;
    valueLabel.font = kGeneralFontSize;
    valueLabel.textColor = [UIColor colorWithHex:@"3c3c3c"];
    //    valueLabel.backgroundColor = kRandomColor;
    valueLabel.tag = 300;
    [guoJIView addSubview:valueLabel];
    
    
    UIButton * btn = [UIButton new];
    btn.frame = CGRectMake(kMainScreenWidth - 30, 10, 10, 10);
    btn.userInteractionEnabled = NO;
    [btn setBackgroundImage:[UIImage imageNamed:@"return-拷贝"]
                   forState:(UIControlStateNormal)];
    [guoJIView addSubview:btn];
    
    LineView * line1 = [LineView new];
    [guoJIView addSubview:line1];
    
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.centerY.mas_equalTo(valueLabel);
        make.right.mas_equalTo(valueLabel.mas_left).offset(-kMargin15);
    }];
    
    [valueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(guoJIView).offset(-kMargin15);
        make.centerY.mas_equalTo(guoJIView);
        make.height.mas_equalTo(35);
        make.width.mas_equalTo(guoJIView).multipliedBy(0.6);
    }];
    
    [line1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(guoJIView).offset(kMargin10);
        make.right.mas_equalTo(guoJIView).offset(-kMargin10);
        make.height.mas_equalTo(1);
        make.bottom.mas_equalTo(guoJIView);
    }];
    
    return guoJIView;
}
@end
